package com.peak.distribution.entity.order;

import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;
import org.hibernate.annotations.LazyToOne;
import org.hibernate.annotations.LazyToOneOption;

import com.peak.distribution.entity.agent.DisAgent;
import com.peak.distribution.enums.Constants;
import com.peak.spring.boot.api.entity.LogicalDeleteEntity;

import lombok.Data;
import lombok.EqualsAndHashCode;

@Entity
@Table(name = "dis_order_receiver")
@Data
@EqualsAndHashCode(callSuper=true)
public class DisOrderReceiver extends LogicalDeleteEntity {

	private static final long serialVersionUID = Constants.DISTRIBUTION_VERSION;

	/** 收货人 */
	private String receiver;

	/** 省 */
	private String province;

	/** 市 */
	private String city;

	/** 区县 */
	private String region;

	/** 收货地址 */
	private String address;

	/** 收货人电话 */
	private String phone;

	/** 收货邮编 */
	private String zip;
	
	/** 默认地址 */
	private Boolean isDefault;
	
	/** 代理 */
	private DisAgent agent;
	
	@ManyToOne
	@JoinColumn(name = "agent_id")
	@Fetch(FetchMode.SELECT)
	@LazyToOne(LazyToOneOption.PROXY)
	public DisAgent getAgent() {
		return agent;
	}
}
